package com.hhkj.admin.sale.domain;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BizBaseEntity;
import com.ruoyi.common.valid.VAdd;
import com.ruoyi.common.valid.VEdit;
import lombok.*;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 *
 */
@EqualsAndHashCode(callSuper = true)
@TableName(value = "s_sale")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Sale extends BizBaseEntity {

    /**
     * 编号
     */
    @TableField(value = "num")
    private String num;

    /**
     * 编号
     */
    @TableField(value = "level")
    private String level;

    /**
     * 名字
     */
    @NotBlank(message = "姓名不能为空", groups = {VAdd.class, VEdit.class})
    @TableField(value = "name")
    private String name;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空", groups = {VAdd.class})
    @TableField(value = "password")
    private String password;

    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空", groups = {VAdd.class, VEdit.class})
    @TableField(value = "mobile")
    @Excel(name = "手机号", orderNum = "1", width = 25)
    private String mobile;

    /**
     * 身份证号
     */
    @TableField(value = "id_card")
    private String idCard;

    /**
     * 邀请码地址
     */
    @TableField(value = "invitation_code_url")
    private String invitationCodeUrl;

    /**
     * 销售标识："root"-销售 "sale"-商家
     */
    @TableField(value = "type_code")
    private String typeCode;

    /**
     * 状态：0-正常 1-禁用
     */
    @TableField(value = "disabled_flag")
    private Integer disabledFlag;

    /**
     * 上级商家，关联s_sale
     */
    @TableField(value = "parent_id")
    private Long parentId;

    /**
     * 所属销售，关联s_sale
     */
    @TableField(value = "root_id")
    private Long rootId;

    /**
     * 注册时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @TableField(value = "register_time")
    @Excel(name = "注册时间", orderNum = "2", width = 25, exportFormat = "yyyy-MM-dd HH:mm")
    private Date registerTime;
}